<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="num1">
    <select id="sel">
        <option value="+">加</option>
        <option value="-">减</option>
        <option value="*">乘</option>
        <option value="/">除</option>
        <option value="%">取于</option>
    </select>
    <input type="text" id="num2">
    <button id="btn">等于</button>
    <input type="text" id="result">
</body>
<script>
    var num1Ipt = document.getElementById("num1");
    var sel = document.getElementById("sel");
    var num2Ipt = document.getElementById("num2");
    var btn = document.getElementById("btn");
    var result = document.getElementById("result");
    btn.onclick = function(){
        var num1 = Number(num1Ipt.value);
        var num2 = Number(num2Ipt.value);
        switch(sel.value) {
            case "+": result.value = num1 + num2; break;
            case "-": result.value = num1 - num2; break;
            case "*": result.value = num1 * num2; break;
            case "/": result.value = num1 / num2; break;
            case "%": result.value = num1 % num2; break;
        }
    }
</script>
</html>